// pages/experience/experience.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
        ips: [
      { id: "1", title: "门窗", isSelect:true },
      { id: "2", title: "阳台", isSelect: false},
      { id: "3", title: "全屋定制", isSelect: false},
      { id: "4", title: "窗帘", isSelect: false },
      { id: "5", title: "成品家具", isSelect: false },
      { id: "6", title: "智能灯具", isSelect: false },
      { id: "7", title: "家用电器", isSelect: false },
      { id: "8", title: "净化涂料", isSelect: false }
    ],
    content:"全部"

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

   /**
    * item点击事件
    */
  onIpItemClick: function (event) {
    console.log(event);
    var id = event.currentTarget.dataset.item.id;
    var curIndex = 0;
    for (var i = 0; i < this.data.ips.length; i++) {
      if (id == this.data.ips[i].id) {
        this.data.ips[i].isSelect = true;
        curIndex = i;
      } else {
        this.data.ips[i].isSelect = false;
      }
    }

    this.setData({
      content: this.data.ips[curIndex].title,
      ips: this.data.ips,
    });
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})